package W1028;

import java.util.Arrays;

public class Test02 {
	public static void main(String[] args) {
		int a = 10, b = 20;
		System.out.println(a);
		System.out.println(b);
		change1(a, b);
		System.out.println("------------------------");
		System.out.println(a);
		System.out.println(b);
		System.out.println("**********************");
		System.out.println("------------------------");
		Num num = new Num();
		num.a = 10;
		num.b = 20;
		System.out.println(num.a);
		System.out.println(num.b);
		change2(num);
		System.out.println("---------------------");
		System.out.println(num.a);
		System.out.println(num.b);

		int nums[] = { 10, 20 };
		System.out.println(Arrays.toString(nums));
		change3(nums);
		System.out.println(Arrays.toString(nums));

		int nums2[] = { 10, 20 };
		System.out.println("---------------");
		System.out.println(Arrays.toString(nums2));
		change4(nums2);
		System.out.println(Arrays.toString(nums2));

	}

	public static void change4(int[] nums) {
		nums = new int[] { 20, 10 };
	}

	public static void change3(int[] nums) {
		nums[0] = 20;
		nums[1] = 10;
	}

	public static void change2(Num num) {
		num.a = 20;
		num.b = 10;
	}
 
	public static void change1(int a, int b) {
		// System.out.println(a);
		// System.out.println(b);
		int c = a;
		a = b;
		b = c;
		System.out.println(a);
		System.out.println(b);
	}
}
